﻿<common:LayoutAwarePage
    x:Name="pageRoot"
    x:Class="Eatime.Main.Allmenu"
    DataContext="{Binding DefaultViewModel, RelativeSource={RelativeSource Self}}"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:Eatime.Main"
    xmlns:common="using:Eatime.Main.Common"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Page.Resources>

        <!--
            此页所显示的分组项的集合，绑定到完整
            项列表的子集，因为无法虚拟化组中的项
        -->
        <CollectionViewSource
            x:Name="groupedItemsViewSource"
            Source="{Binding Groups}"
            IsSourceGrouped="true"
            ItemsPath="TopItems"/>

        <!-- TODO: 如果在 App.xaml 中声明了键 AppName，则删除此行-->
        <x:String x:Key="AppName">我的应用程序</x:String>
    </Page.Resources>

    <!--
        此网格用作定义以下两行的页的根面板:
        * 第 0 行包含后退按钮和页标题
        * 第 1 行包含页布局的其余部分
    -->
    <Grid
        Style="{StaticResource LayoutRootStyle}"
        
        DataContext="{Binding Group}"
        d:DataContext="">
        <Grid.Background>
            <ImageBrush ImageSource="Assets/background.png"/>
        </Grid.Background>
        <!--<Grid.Background>
            <ImageBrush  ImageSource=""/>
        </Grid.Background>-->
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="59*"/>
            <ColumnDefinition Width="29*"/>
            <ColumnDefinition Width="595*"/>
        </Grid.ColumnDefinitions>

        <Grid.RowDefinitions>
            <RowDefinition Height="132"/>
            <RowDefinition Height="3"/>
            <RowDefinition/>
        </Grid.RowDefinitions>
        <!--ItemsSource="{Binding Source={StaticResource itemsViewSource}}"-->
        <!-- 在大多数视图状态中使用的水平滚动网格-->
        <GridView
            x:Name="itemGridView"
            AutomationProperties.AutomationId="ItemGridView"
            AutomationProperties.Name="Items In Group"
            TabIndex="1"
            Padding="0,7,120,50"
            SelectionMode="None"
            IsSwipeEnabled="false"
            IsItemClickEnabled="True"
            ItemClick="ItemView_ItemClick" Margin="0,47,0,2" Grid.Row="2" Grid.ColumnSpan="2" Grid.Column="1">
            <GridView.ItemTemplate>
                <DataTemplate>
                    <Grid Height="125" Width="160">
                        <Image  Source="Assets/TextImage/cp.png"  Height="125" Width="160"/>
                        <Border VerticalAlignment="Bottom" Background="Black" Opacity="0.6"/>
                        <TextBlock Text="{Binding Title}" HorizontalAlignment="Left" Margin="10,0,0,20" VerticalAlignment="Bottom" FontSize="18">
                        </TextBlock>
                        <TextBlock Text="{Binding Price}" HorizontalAlignment="Right" Margin="0,0,10,20" VerticalAlignment="Bottom" FontSize="18">
                        </TextBlock>
                    </Grid>
                </DataTemplate>
            </GridView.ItemTemplate>
                
         
            

            <!--<GridView.Header>
                <StackPanel Width="480" Margin="0,4,14,0">
                    <TextBlock Text="{Binding Subtitle}" Margin="0,0,18,20" Style="{StaticResource SubheaderTextStyle}" MaxHeight="60"/>
                    <Image Source="{Binding Image}" Height="400" Margin="0,0,18,20" Stretch="UniformToFill" AutomationProperties.Name="{Binding Title}"/>
                    <TextBlock Text="店铺信息" Margin="0,0,18,0" Style="{StaticResource BodyTextStyle}"/>
                </StackPanel>
            </GridView.Header>-->
            <GridView.ItemContainerStyle>
                <Style TargetType="FrameworkElement">

                    <Setter Property="Margin" Value="0,0,0,0"/>
                </Style>
            </GridView.ItemContainerStyle>
        </GridView>
        <!--ItemsSource="{Binding Source={StaticResource itemsViewSource}}"-->
        <!-- 垂直滚动列表仅在对齐后使用-->
        <ListView
            x:Name="itemListView"
            AutomationProperties.AutomationId="ItemListView"
            AutomationProperties.Name="Items In Group"
            TabIndex="1"
            Grid.Row="2"
            Visibility="Collapsed"
            Padding="10,0,0,60"
          
            ItemTemplate="{StaticResource Standard80ItemTemplate}"
            SelectionMode="None"
            IsSwipeEnabled="false"
            IsItemClickEnabled="True"
            ItemClick="ItemView_ItemClick"  Grid.ColumnSpan="3">

            <!--<ListView.Header>
                <StackPanel>
                    <TextBlock Text="{Binding Subtitle}" Margin="10,0,18,20" Style="{StaticResource TitleTextStyle}" MaxHeight="60"/>
                    <Image Source="{Binding Image}" Margin="10,0,18,0" MaxHeight="160" Stretch="UniformToFill" AutomationProperties.Name="{Binding Title}"/>
                    <TextBlock Margin="10,20,18,30" Text="{Binding Description}" Style="{StaticResource BodyTextStyle}"/>
                </StackPanel>
            </ListView.Header>-->
        </ListView>

        <!-- 后退按钮和页标题-->
        <Grid Grid.RowSpan="3" Margin="0,48,0,623" Grid.ColumnSpan="3">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Button x:Name="backButton" Click="GoBack" IsEnabled="{Binding Frame.CanGoBack, ElementName=pageRoot}" Style="{StaticResource BackButtonStyle}"/>
            <TextBlock x:Name="pageTitle" Text="" Style="{StaticResource PageHeaderTextStyle}" Grid.Column="1" IsHitTestVisible="false"/>
        </Grid>
        <ComboBox DisplayMemberPath="Name" SelectionChanged="Menu_Combox_SelectionChanged_1" SelectedValuePath="CatId" HorizontalAlignment="Left" Name="Menu_Combox"   Grid.Row="2" VerticalAlignment="Top" Width="156" Grid.Column="1" Grid.ColumnSpan="2">
        
        </ComboBox>

        <VisualStateManager.VisualStateGroups>

            <!-- 视觉状态反映应用程序的视图状态-->
            <VisualStateGroup x:Name="ApplicationViewStates">
                <VisualState x:Name="FullScreenLandscape"/>
                <VisualState x:Name="Filled"/>

                <!-- 整页采用较窄的 100 像素页边距约定(纵向)-->
                <VisualState x:Name="FullScreenPortrait">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="backButton" Storyboard.TargetProperty="Style">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PortraitBackButtonStyle}"/>
                        </ObjectAnimationUsingKeyFrames>

                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="itemGridView" Storyboard.TargetProperty="Padding">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="100,126,90,0"/>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>

                <!--
                    对齐后，后退按钮和标题的样式将有所不同，并且列表表示形式将被
                    所有视图状态中显示的网格所替代
                -->
                <VisualState x:Name="Snapped">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="backButton" Storyboard.TargetProperty="Style">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SnappedBackButtonStyle}"/>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="pageTitle" Storyboard.TargetProperty="Style">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SnappedPageHeaderTextStyle}"/>
                        </ObjectAnimationUsingKeyFrames>

                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="itemGridView" Storyboard.TargetProperty="Visibility">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="itemListView" Storyboard.TargetProperty="Visibility">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
    </Grid>
</common:LayoutAwarePage>
